<template>
  <div>
    <el-tabs v-model="activeName" type="card" @tab-click="handleClick">
      <el-tab-pane :label="firsname" name="first">
        <guanli :userName="userName" v-if="absole == '1'"></guanli>
      </el-tab-pane>
      <el-tab-pane :label="seconame" name="second">
        <baomi :userName="userName" v-if="absole == '2'"></baomi>
      </el-tab-pane>
    </el-tabs>
  </div>
</template>
  
<script>
import guanli from "./guanli.vue";
import baomi from "./baomi.vue";
export default {
  name: "auditcation",
  data() {
    return {
      activeName: "first",
      firsname: "",
      seconame: "",
      userName: "",
      absole: "1",
    };
  },
  created() {
    this.userName = window.sessionStorage.getItem("userName");
    console.log(this.userName);
    if (this.userName == "secadm") {
      this.firsname = "管理员日志";
      this.seconame = "用户日志";
    } else if (this.userName == "auditadm") {
      this.firsname = "管理员";
      this.seconame = "保密员";
    } else {
      this.firsname = "管理员日志";
      this.seconame = "用户日志";
    }
  },
  components: {
    guanli,
    baomi,
  },
  methods: {
    handleClick(tab, event) {
      console.log(tab, event);
      if (tab.name == "first") {
        this.absole = "1";
      } else if (tab.name == "second") {
        this.absole = "2";
      }
    },
  },
};
</script>
  
<style scoped>
</style>